/*
Copyright 2007 Raymond Giorgi

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
 */

package edu.pitt.CS2510.View;

import java.awt.Color;
import java.awt.Graphics;

/**
 * This class is responsible for representing an enemy grid piece
 * 
 * @author NoOne
 * 
 */
public class EnemyBlock extends Shape {
	private int units;

	/**
	 * set the coordinate as well as how many units are stationed here
	 * 
	 * @param x
	 * @param y
	 * @param units
	 */
	public EnemyBlock(int x, int y, int units) {
		super(x, y);
		color = Color.red;
		this.units = units;
	}

	/**
	 * Draw the block
	 */
	@Override
	public void draw(Graphics g) {
		g.setColor(color);
		g.fillRect(x, y, 20, 20);
		g.setColor(Color.black);
		g.drawChars(Integer.toString(units).toCharArray(), 0, Integer.toString(
				units).length(), x, y + 20);
	}

	/**
	 * Set the number of units stationed here. Useful because this number is
	 * always decreasing as the game goes on.
	 * 
	 * @param units
	 */
	public void setUnits(int units) {
		this.units = units;
	}
}
